<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGridTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('grid', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name',40)->default('')->comment('网格名称');
            $table->integer('street_id')->default(0)->comment('街道id');
            $table->integer('village_id')->default(0)->comment('村庄id');
            $table->integer('project_id')->default(0)->comment('项目id');
            $table->integer('segment_id')->default(0)->comment('号段id');
            $table->integer('grid_group_id')->default(0)->comment('网格组id');
            $table->integer('opinion')->default(0)->comment('拆迁意见1同意2拒绝');
            $table->integer('assess_company_id')->default(0)->comment('评估机构id(是否评估)');
            $table->integer('mapping_company_id')->default(0)->comment('测绘机构id(是否测绘)');
            $table->integer('house_use')->default(0)->comment('房屋用途1住宅2非住宅3住宅非住宅兼用房屋4未登记建筑和用途不清的房屋 ');
            $table->integer('build_form')->default(0)->comment('建筑形式');
            $table->integer('supply_form')->default(0)->comment('补偿方式1货币2房屋');
            $table->integer('dualuse_area')->default(0)->comment('是否有兼用面积1有0没有');
            $table->string('disagree_reason')->default('')->comment('不同意拆迁理由');
            $table->integer('if_agent')->default(0)->comment('是否需要代理0不需要1需要');
            $table->integer('receive_villager_id')->default(0)->comment('补偿款领取人');
            $table->string('address')->default('')->comment('路号户');
            $table->string('business_imgs')->default('')->comment('营业执照照片');
            $table->string('business_num')->default('')->comment('营业执照编号');
            $table->string('business_award_time')->default('')->comment('营业执照颁发时间');
            $table->integer('idcard_status')->default(0)->comment('入户-身份证填写状态0未开始1已完成');
            $table->integer('hukou_status')->default(0)->comment('入户-户口本填写状态0未开始1已完成2审批中');
            $table->integer('fangchan_status')->default(0)->comment('入户-房产土地证填写状态0未开始1已完成2审批中');
            $table->integer('area_status')->default(0)->comment('入户-面积确认表填写状态0未开始1已完成');
            $table->integer('into_door_status')->default(0)->comment('入户状态0未开始1已完成2进行中');
            $table->integer('mapping_status')->default(0)->comment('测绘状态0未开始1已完成2审批中');
            $table->integer('assess_status')->default(0)->comment('评估状态0未开始1已完成2审批中');
            $table->integer('house_status')->default(0)->comment('户型状态0未开始1已完成');
            $table->integer('sign_status')->default(0)->comment('签约状态0未开始1已完成2审批中');
            $table->integer('vacate_room_status')->default(0)->comment('腾房状态0未开始1已完成2审批中');
            $table->integer('settlement_status')->default(0)->comment('结算状态0未开始1已完成2审批中');
            $table->integer('bank_status')->default(0)->comment('银行状态0未开始1已完成2审批中');
            $table->integer('grant_status')->default(0)->comment('发放状态0未开始1已完成2审批中');  
            $table->integer('for_user_id')->default(0)->comment('负责人id');
            $table->integer('if_mapping')->default(0)->comment('有证有无异议1有2无');
            $table->integer('if_build')->default(0)->comment('无证有无建房手续1有2无');
            $table->integer('if_sign')->default(0)->comment('是否签约0未签约1签约');
            $table->timestamp('sign_time')->nullable()->comment('签约时间');
            $table->string('sign_num')->nullable()->comment('协议编号');
            $table->integer('pid')->default(0)->comment('拆分网格父级id');

            $table->timestamps();
            $table->softDeletes();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `grid` comment '网格表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('grid');
    }
}
